package com.wlz.provider.service;

import com.wlz.api.DemoService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.config.annotation.Service;
import org.apache.dubbo.rpc.RpcContext;

/**
 * @author wlz
 * @date 2022-07-11  11:52 下午
 */
@Slf4j
@Service(version = "default")
public class DefaultDemoService implements DemoService {

    @Override
    public String sayHello(String name) {
        log.info("DefaultDemoService  sayHello 执行了服务 : {}", name);
        URL url = RpcContext.getContext().getUrl();
        return String.format("%s：%s, Hello, %s", url.getProtocol(), url.getPort(), name);
    }
}
